//
//  DSZDiZhiGLViewController.m
//  7.13苏宁框架
//
//  Created by app05 on 15/7/22.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "DSZDiZhiGLViewController.h"
#import "DSZNavigationBarView.h"
#import "DSZMoreView.h"
#import "DSZSHDZVeiw.h"
#import "DSZMainViewController.h"
#import "HomeViewController.h"
#import "DSZShopViewController.h"
@interface DSZDiZhiGLViewController ()<UITableViewDataSource,UITableViewDelegate,navigationBarDelegata,tableViewIndexPathRowDelegate,back>

@property(nonatomic,weak)UIView *moreView;
@property(nonatomic,assign)BOOL flag;

@end

@implementation DSZDiZhiGLViewController

-(void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBar.alpha=0;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIView *view=[[UIView alloc]initWithFrame:self.view.bounds];
    view.backgroundColor=[UIColor whiteColor];
    self.view=view;
    self.view.userInteractionEnabled=YES;
    
    [self addNavBar];
    
    [self addContentView];
}
-(void)addNavBar
{
    DSZNavigationBarView *nav=[[DSZNavigationBarView alloc]initWithFrame:CGRectZero];
    nav.frame=CGRectMake(0, 20, 320, 44);
    [self.view addSubview:nav];
    nav.delegate=self;
    nav.titleLabel=@"地址添加";
}
-(void)addContentView
{
    DSZSHDZVeiw *shdi=[DSZSHDZVeiw locationView];
    shdi.delegate=self;
    shdi .frame=CGRectMake(0, 64, 320, 480-64);
    [self.view addSubview:shdi];
    
}
-(void)btnClick
{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)backToLastController
{
    [self btnClick];
}
-(void)moreBtnClick
{
    
    if (!self.flag) {
        DSZMoreView *more=[DSZMoreView moreView];
        more.delegate=self;
        more.frame=CGRectMake(185, 65, 146, 229);
        self.moreView=more;
        [self.view addSubview:self.moreView];
        self.flag=YES;
    }
    else
    {
        [self.moreView removeFromSuperview];
        self.moreView=nil;
        self.flag=NO;
    }
}

-(void)dszMoreViewWithIndexRow:(NSInteger)indexPathRow
{
    if (indexPathRow==0) {
        UIStoryboard *story=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
        DSZMainViewController *main=[story instantiateViewControllerWithIdentifier:@"main"];
        //DSZMainViewController *main=[[DSZMainViewController alloc]init];
        [self presentViewController: main animated:NO completion:nil];
    }else if (indexPathRow==1)
    {}
    else if (indexPathRow==2)
    {
        UIStoryboard *story=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
        
        DSZShopViewController *shop=[story instantiateViewControllerWithIdentifier:@"shop"];
        [self.navigationController pushViewController:shop animated:NO];
        self.flag=YES;
        [self moreBtnClick];
        self.navigationController.navigationBar.alpha=1;
        DSZMainViewController *main=(DSZMainViewController*)self.tabBarController;
        [main hiddenMainTabbar:YES];
    }else if (indexPathRow==3)
    {
        [self.navigationController popToRootViewControllerAnimated:YES];
        
    }
    
}


@end
